#include "Arduino.h"

#define PIN_BUZZER 5

int Buzzer_Freq = 1000;
int Buzzer_PWM_Channel = 0;
int Buzzer_PWM_Duty = 512;
int Buzzer_PWM_Res = 10;


void setup()
{
  Serial.begin(115200);
  pinMode(PIN_BUZZER,OUTPUT);
  digitalWrite(PIN_BUZZER,LOW);

  ledcSetup(Buzzer_PWM_Channel,Buzzer_Freq,Buzzer_PWM_Res);
  ledcAttachPin(PIN_BUZZER,Buzzer_PWM_Channel);
}

void loop()
{
  ledcWriteTone(Buzzer_PWM_Channel,Buzzer_Freq);
  ledcWrite(Buzzer_PWM_Channel,Buzzer_PWM_Duty);
  delay(500);

  ledcWrite(Buzzer_PWM_Channel,0);
  delay(500);
}
